package com.pojoin.cms.action;

public class SessionAction extends BaseActionSupport {
	
	private static final long serialVersionUID = 1L;
	
	private String userName;
	private String passWord;
	

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassWord() {
		return passWord;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}


	/**
	 * 登录
	 * @return
	 */
	public String login(){
		if(this.sessionServer.registerSession(userName, passWord)){
			return this.success("index.jsp");  //成功进入主页面
		}
		this.msg = "用户名或密码错误";
		return this.success("login.jsp");     //失败进入登录界面
	}
	
	/**
	 * 退出
	 * @return
	 */
	public String logout(){
		this.sessionServer.logoutSession();
		return this.success("login.jsp");
	}
}
